/** 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package it.free.i.virtual.machine.hal.devicealias;

import java.util.Hashtable;

/**  
 * Keep the list of virtual devices (device alias) for real devices mapped by a virtual one in the virtual world
 * @author stefano
 */
@SuppressWarnings("hiding")
public final class DeviceAliasInventory extends Hashtable<String, DeviceAlias> {

	private static final long serialVersionUID = 1206637208827008757L;
	private static DeviceAliasInventory DEVICE_ALIAS_INVENTORY_INSTANCE = null;
	
	/**
	 * Private as for a singleton
	 */
	private DeviceAliasInventory() {
		super();
	}

	/**
	 * @param initialCapacity
	 */
	private DeviceAliasInventory(int initialCapacity) {
		super(initialCapacity);
	}

	/**
	 * @param initialCapacity
	 * @param loadFactor
	 */
	private DeviceAliasInventory(int initialCapacity, float loadFactor) {
		super(initialCapacity, loadFactor);
	}
	
	/**
	 * Factory singleton private instance accesor
	 * @return THE instance of this factory
	 */
	public static DeviceAliasInventory getInstance(){
		if(DEVICE_ALIAS_INVENTORY_INSTANCE == null){
		   synchronized (DeviceAliasInventory.class){
			   if(DEVICE_ALIAS_INVENTORY_INSTANCE == null){
				   DEVICE_ALIAS_INVENTORY_INSTANCE = new DeviceAliasInventory(); 
			   }	   
		   }
		}
		return DEVICE_ALIAS_INVENTORY_INSTANCE;
	}

}
